package cn.edu.ctgu.junitTest4;

public class PremiumCalculator {
    public double premiumCalculate(int money,int age,String sex,String maritalStatus,int raisingNumber){
        double point=0;
        double premiumPrice;
        assert money>0;
        assert age>0;
        assert sex.equals("M")||sex.equals("F");
        assert maritalStatus.equals("已婚")||maritalStatus.equals("未婚");
        assert raisingNumber>=0;
        if(age>=20&&age<40){
            point+=6;
        }
        else if(age>=40&&age<60){
            point+=4;
        }
        else{
            point+=2;
        }
        if(sex.equals("M")){
            point+=4;
        }
        else {
            point+=3;
        }
        if(maritalStatus.equals("已婚")){
            point+=3;
        }
        else{
            point+=5;
        }
        if(raisingNumber>=6){
            point-=3;
        }
        else{
            point-=0.5*raisingNumber;
        }
        if(point>=10){
            premiumPrice=0.006*money;
        }
        else{
            premiumPrice=0.001*money;
        }
        return premiumPrice;
    }
}
